<style type="text/css">
    .vote_ul li{
        height: 37px;
        margin-bottom : 3px;
    }
    .vote_ul li input {
        float: left;
        width: 60%;
    }
    .vote_ul li .operate {
        margin-left: 6px;
        display: block;
        float: left;
        cursor: pointer;
        width: 30%;
    }
    .vote_ul li a{
        font-size:19px;
    }
    .form-box {
        border: 1px solid #ccc;
        padding: 15px 15px 0px 15px;
        margin-bottom: 15px;
        width: 662px;
        float: left;
    }
    .form-box .col-sm-5 {
        width: 530px
    }
    .form-box .col-sm-5 input{
      width: 450px;
    }
    .form-box .form-group label{
        width: 100px;
        margin-left: 17px;
    }
    .form-box  .vote_ul li .operate {
        width: 40px;
    }
    .form-box  .col-sm-4 {
      width: 476px;
    }
     .form-box-left .form-box-t {
        padding-right: 29px;
    }
</style>
<form action="" class="form-horizontal" role="form">
 <div class="form-group ">
        <label class="col-sm-2 control-label">投票名称</label>
        <div class="col-sm-5">
            <input type="text" id="name" class="form-control" name="name" placeholder="" datatype="*" value="{$vote.name}"/>
        </div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label">投票标题</label>
        <div class="col-sm-5">
            <input type="text" id="title" class="form-control" name="title" placeholder="" datatype="*" value="{$vote.title}"/>
        </div>
    </div>
    <div class="form-group">
    <label class="col-sm-2 control-label">投票时间</label>
    <div class="row">
      <div class="col-sm-5">
        <div class="input-group">
          <span class="input-group-addon">开始</span>
          <input type="text" class="form-control" id="start-time" name="start_time" placeholder="请选择投票开始时间" value="{$vote.start_time}">
          <span class="input-group-addon">-</span>
          <input type="text" class="form-control" id="end-time" name="end_time" placeholder="请选择投票结束时间" value="{$vote.end_time}">
          <span class="input-group-addon">结束</span>
        </div>
      </div>
    </div>
  </div>
   <div class="form-group">
        <label class="col-sm-2 control-label">选择方式</label>
        <div class="col-sm-5">
            {$vote.selectOptionsRadio}
        </div>
    </div>
      
    <div class="form-group" id="options-down" style="display:none;">
        <label class="col-sm-2 control-label">选项个数</label>
        <div class="col-sm-5">
            <input type="number"  id="select_items" class="form-control form-number" name="select_items" min="1"  value="{$vote.select_items}">
        </div>
  </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">投票说明</label>
        <div class="col-sm-5">
            <textarea id="desc" name="desc" class="form-control">{$vote.desc}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">提交返回文本</label>
        <div class="col-sm-5">
            <textarea id="result_text" name="result_text" class="form-control">{$vote.result_text}</textarea>
        </div>
    </div>
   
     <div class="form-group">
        <label class="col-sm-2 control-label">选择方式</label>
        <div class="col-sm-5">
            {$vote.timeOptionsRadio}
        </div>
    </div>
    
     <div class="form-group days-time-shi">
    <label class="col-sm-2 control-label">计时时间</label>
    <div class="row">
      <div class="col-sm-5">
        <div class="input-group">
          <input type="number" class="form-control"  name="minutes" min="0" placeholder="请输入间隔时间" value="{$vote.minutes}">
          <span class="input-group-addon">分</span>
        </div>
      </div>
    </div>
  </div>
<div class="form-group days-time" >
        <label class="col-sm-2 control-label">投票次数</label>
         <div class="row">
        <div class="col-sm-5">
           <div class="input-group">
            <input type="number"  class="form-control" name="vote_times" min="1" value="{$vote.vote_times}">
            <span class="input-group-addon">/用户</span>
            </div>
        </div>
        </div>
  </div>
   <div class="form-group">
      <label class="col-sm-2 control-label">展览图片</label>
      <div class="col-sm-5">
        <div class="image-result-content">
          <img id="image-result-y" style="width:60px;"  class="margin-bottom" />
        </div>
        <input type="text" id="image-y" name="pic" class="form-control margin-bottom" value="{$vote.pic}"/>
      <input type="file" id="image_upload-y" />
      </div>
  </div>
   <!--  <div class="form-box-left"><label class="col-sm-2 control-label form-box-t">选择项目</label></div>  
    <div class="form-box" id="form-box">    
       <if condition="$vote['answer'] && count($vote['answer']) gt 0">
       <volist id="vo" name="vote['answer']" key="key">
           <div class="form-box-b">
                <div class="form-group">
                    <label class="col-sm-2 control-label">选项标题{$key}</label>
                    <div class="col-sm-5">
                        <ul class="vote_ul">                    
                            <li>
                                <input name="answer[{$key-1}][answer]" type="text" class="form-control answer" value="{$vo.answer}"/>
                                <input name="answer[{$key-1}][id]" type="hidden" class="answer_id" value="{$vo.id}"/>
                                <span class="operate"><a class="add">+</a> / <a class="del">-</a></span>
                            </li>                               
                        </ul>
                    </div>
                </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">选项图片</label>
                    <div class="col-sm-4">
                        <div class="image-result-content">
                            <img id="image-result-{$key}" style="width:60px;" class="margin-bottom" />
                        </div>
                        <input type="text" id="image-{$key}" name="image[]" class="form-control margin-bottom" value={$vo.pic} />
                        <input type="file" name="image_upload" id="image_upload-{$key}" />
                    </div>            
                </div>
           </div>
       </volist>
       <else/>
           <div class="form-box-b">
                <div class="form-group">
                    <label class="col-sm-2 control-label">选项标题</label>
                    <div class="col-sm-5">
                        <ul class="vote_ul">    
                             <li>
                                 <input name="answer[][answer]" type="text" class="form-control answer"/>
                                 <span class="operate"><a class="add">+</a> / <a class="del">-</a></span>
                             </li>
                        </ul>
                    </div>
                </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">选项图片</label>
                    <div class="col-sm-4">
                        <div class="image-result-content">
                            <img id="image-result-1" style="width:60px;" class="margin-bottom" />
                        </div>
                        <input type="text" id="image-1" name="image[]" class="form-control margin-bottom" />
                        <input type="file" name="image_upload" id="image_upload-1" />
                   </div>            
                </div>
           </div>
        </if>
    </div> -->
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
            <a class="btn btn-default" onclick="javascript:history.go(-1)">返回上页</a>
            <a class="btn btn-default" onclick="self.location=document.referrer">返回上页并刷新</a>
            <input type="hidden" name="id" value="{$vote.id}"/>
            <button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/save">保存更改</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    $(function() {
        for(var i=1;i<$('#form-box .form-box-b').size()+1;i++){
            oUploadify(i);
        }
        oUploadify("y");
        oInitial();
    });
</script>
<!-- uploadify -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/uploadify/uploadify.css">
<script type="text/javascript" src="__PUBLIC__/Style/Common/uploadify/jquery.uploadify.min.js?{:rand(0,9999)}"></script>
<script type="text/javascript">
    function oAppend(obj){
          $("#form-box").append(
              "<div class='form-box-b'><div class='form-group'><label class='col-sm-1 control-label'>选项标题</label><div class='col-sm-5'><ul class='vote_ul'><li><input name='answer[][answer]' type='text' class='form-control answer' /> <span class='operate'><a class='add'>+</a> / <a class='del'>-</a></span></li></ul></div></div><div class='form-group' id='list-img'><label class='col-sm-1 control-label'>选项图片</label><div class='col-sm-4'><div class='image-result-content'><img id='image-result-"+
              obj+"' style='width:60px;' class='margin-bottom' /></div><input type='text' id='image-"+
              obj+"' name='image[]' class='form-control margin-bottom' /><input type='file' name='image_upload' id='image_upload-"+
              obj+"' /></div></div></div>"
          )
          $("#image_upload-"+obj).uploadify({
              'multi'         :   false,
              'fileSizeLimit' :   '200kb',
              'buttonText'    :   '选择图片',
              'fileTypeDesc'  :   'Image Files',
              'fileTypeExts'  :   '*.jpg; *.png',
              'swf'           :   '__PUBLIC__/Style/Common/uploadify/uploadify.swf',
              'uploader'      :   '__MODULE__/Upload/uploadOne',
              'onUploadSuccess'   : function(data, res){  
                  var url = eval("(" + res + ")").extra.url;
                  $("#image-result-"+obj).attr("src", url);
                  $("#image-"+obj).val( url );             
              }
          });
    }
    function oInitial(){
        $("#form-box").delegate(".add","click",function(){
            oAppend($(".uploadify").size()+1);
       })
       $("#form-box").delegate(".del","click",function(){
            if( $("#form-box .form-box-b").size() > 1 ) {
                   $(this).parents('.form-box-b').remove();
            }
       })
    }
    function oUploadify(obj){
        $("#image_upload-"+obj).uploadify({
            'multi'         :   false,
            'fileSizeLimit' :   '200kb',
            'buttonText'    :   '选择图片',
            'fileTypeDesc'  :   'Image Files',
            'fileTypeExts'  :   '*.jpg; *.png',
            'swf'           :   '__PUBLIC__/Style/Common/uploadify/uploadify.swf',
            'uploader'      :   '__MODULE__/Upload/uploadOne',
            'onUploadSuccess'   : function(data, res){
                var url = eval("(" + res + ")").extra.url;
                $("#image-result-"+obj).attr("src", url);
                $("#image-"+obj).val( url );
            }
        });  
    }
/* 选择方式隐藏与显示 */
 $(function(){
     if($("#select_options_0").is(':checked')){
    	 $("#select_items").val("1");
    	$("#options-down").hide();
         
     }else{
         $("#options-down").show();
     };
     $("#select_options_0").click(function(){
    	 $("#select_items").val("1");
         $("#options-down").hide();
        
     });
     $("#select_options_1").click(function(){
     $("#options-down").show();
   });
    /*选择方式*/
     if($("#time_type_0").is(':checked')){
    	   $(".days-time-shi").hide();
    	   $(".days-time").show();
           
       }else{
    	   $(".days-time-shi").show();
    	   $(".days-time").hide();
       };
       $("#time_type_0").click(function(){
    	   $(".days-time-shi").hide();
         $(".days-time").show();
          
       });
       $("#time_type_1").click(function(){
    	   $(".days-time-shi").show();
         $(".days-time").hide();
      });
     
     
 })
</script>

<!-- datetimepicker -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/datetimepicker/jquery-ui-1.10.0.custom.min.css">
<script type="text/javascript" src="__PUBLIC__/Style/Common/datetimepicker/jquery-ui-1.10.0.custom.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Style/Common/datetimepicker/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="__PUBLIC__/Style/Common/datetimepicker/jquery-ui-timepicker-zh-CN.js"></script>
<script type="text/javascript">
  //时间

  $("#start-time").datetimepicker( { "timeFormat": "HH:mm" } );
  $("#end-time").datetimepicker( { "timeFormat": "HH:mm" } );

</script>